//1185.一周中的第几天
//https://leetcode.cn/problems/day-of-the-week/description/?envType=daily-question&envId=2023-12-30
class Solution {
    //星期返回值
    string week[7] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday","Saturday","Sunday"};
    //每月天数
    vector<int> monthDays = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30};
public:
    string dayOfTheWeek(int day, int month, int year) {
        //计算year之前年数 每年天数的总和
        //每一年默认按365天算 然后计算闰年数 闰年多一天 加上即可
        int days = (365*(year-1971)) + ((year-1969)/4);
        
        //计算从 今年的一月一日到当前月的上个月有多少天
        for(int i = 0;i<month-1;++i) days += monthDays[i];

        //如果月份大于等于3 且为闰年 则要多加一天
        if((month >= 3) && (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))) days += 1;
        days += day; //加上本月的天数
        return week[(days+3)%7];
    }
};